<?php

/**
 * StkIn form base class.
 *
 * @method StkIn getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseStkInForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'acct_set_id'  => new sfWidgetFormInputText(),
      'stkin_no'     => new sfWidgetFormInputText(),
      'pno_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('MfgPno'), 'add_empty' => false)),
      'stk_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('StkDept'), 'add_empty' => false)),
      'stkin_qty'    => new sfWidgetFormInputText(),
      'stkin_up'     => new sfWidgetFormInputText(),
      'stkin_amt'    => new sfWidgetFormInputText(),
      'spl_id'       => new sfWidgetFormInputText(),
      'stkin_type'   => new sfWidgetFormInputText(),
      'stkin_opr'    => new sfWidgetFormInputText(),
      'stkin_status' => new sfWidgetFormInputText(),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'acct_set_id'  => new sfValidatorInteger(),
      'stkin_no'     => new sfValidatorString(array('max_length' => 45)),
      'pno_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('MfgPno'))),
      'stk_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('StkDept'))),
      'stkin_qty'    => new sfValidatorNumber(),
      'stkin_up'     => new sfValidatorNumber(array('required' => false)),
      'stkin_amt'    => new sfValidatorNumber(array('required' => false)),
      'spl_id'       => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'stkin_type'   => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'stkin_opr'    => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'stkin_status' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'created_at'   => new sfValidatorDateTime(),
      'updated_at'   => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('stk_in[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'StkIn';
  }

}
